
package view;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;



public class Board extends Composite{
	

private final int N = 4;
private int[][] boardData;
private Tile tiles[][];

public Board(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(N,true));
	setBackground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
	boardData = new int [N][N];
	tiles = new Tile[N][N];
	}


public void setBoardData(int[][] boardData) {
	this.boardData = boardData;

}

public void updateTiles(){
	
	for (int i=0; i<N; i++){
		for (int j=0; j<N; j++){
			if (tiles[i][j] == null){
				tiles[i][j] = new Tile(this,SWT.BORDER);
			}
			tiles[i][j].setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
			tiles[i][j].setValue(boardData[i][j]);
		}
}






}}